Cytosim's assertions.
More...
|
| #define | NDEBUG |
| |
|
#define | SFILE strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__ |
| | strips the full pathname for a file name
|
| |
|
#define | SFUNC __PRETTY_FUNCTION__ |
| | print the current function name:
|
| |
|
#define | TRACE fprintf(stderr, " while executing '%s'\n in file %s line %d\n", SFUNC, SFILE, __LINE__); |
| |
| #define | assert_true(ignore) ((void) 0) |
| |
|
#define | assert_false(ignore) ((void) 0) |
| |
|
#define | assert_small(ignore) ((void) 0) |
| |
| #define | ERROR(message) |
| |
| #define | ABORT(message) |
| |
| #define | EXIT(message, value) |
| |
Value:{\
fprintf(stderr, "ERROR `%s'\n", message);\
TRACE;\
abort();\
}
| #define assert_true |
( |
|
ignore | ) |
((void) 0) |
assert_true(X) stops the program if condition X is false. assert_false(X) stops if X is true, and prints the value of X.
Value:{\
fprintf(stderr, "ERROR `%s'\n", message);\
TRACE;\
exit(EXIT_FAILURE);\
}
ERROR(message) simply stops the program with some information ABORT(message) will generate a Core file in addition EXIT(message, value) will stop the program with the specified exit value
| #define EXIT |
( |
|
message, |
|
|
|
value |
|
) |
| |
Value:{\
fprintf(stderr, "Cytosim: %s\n", message);\
exit(value);\
}
defining NDEBUG disables:
- the standard assert() macro and
- the assert macros defined below, it makes the executable faster but less safe: